<div class="navbar-jianshu shrink">
	<div class="dropdown">
		<a class="dropdown-toggle logo" data-target="#nav-menu" href="javascript:showMenu()">SIN</a>
		<ul class="dropdown-menu" id="nav-menu">
			<li>
				<a href="__HTP____URL__" title="home">
					<i class="glyphicon glyphicon-home"></i>Index
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/categories.html" title="categories">
					<i class="glyphicon glyphicon-book"></i>Categories
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/tags.html" title="tags">
					<i class="glyphicon glyphicon-tag"></i>Tags
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/album.html" title="album">
					<i class="glyphicon glyphicon-picture"></i>Pictures
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/messages.html" title="messages">
					<i class="glyphicon glyphicon-envelope"></i>Messages
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/links.html" title="links">
					<i class="glyphicon glyphicon-link"></i>Links
				</a>
			</li>
			<li>
				<a href="__HTP____URL__/about.html" title="about">
					<i class="glyphicon glyphicon-info-sign"></i>About
				</a>
			</li>
		</ul>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		$('.main').click(function(){
			$('.dropdown-menu').css('display','none');
		});
	});
	var menuState = 0;
	function showMenu(){
		menuState = !menuState;
		if (menuState) {
			$('.dropdown-menu').fadeIn('slow');
		}else{
			$('.dropdown-menu').fadeOut('slow');
		}
	}
	function logout(){
		$.post("__HTP____URL__/index/User/logout", {});
		location.reload();
	}
    function alertLogin(){
    	accOpt("Login");
    }
    function alertRegister(){
    	accOpt("Register");
    }
    // 用户注册或登录，传入字符串
    function accOpt(opt){
    	// 如果已经存在登录或注册框,则删除先前创建的
        $(".overCurtain").remove();
        $(".hide-center").remove();
    	$.ajax({
            url:"__HTP____URL__/index/user/alert"+opt,
            data:{},
            type:"GET",
            dataType:"JSON",
            success: function(html){
                $("body").append(html);
                // 滚动
                $('body').css('overflow','hidden');    
                showLogin();
            }
        })
    }
</script>




<div class="navbar-user">

	<a target="_self" class="login" href="__HTP____URL__/admin.html" title="admin">
		<i class="glyphicon glyphicon-cog"></i>后台
	</a>
	{if $Think.session.user.user_name}
	<a target="_self" class="login" href="javascript:logout()">
		<i class="glyphicon glyphicon-cog"></i>退出
	</a>
	<a target="_self" class="login user-name" href="__HTP____URL__/user.html">
		<i class="glyphicon glyphicon-user"></i>  
		<b>{$Think.session.user.user_name}</b>
	</a>
    {else}
    <a target="_self" class="login" href="javascript:alertLogin()">
		<i class="glyphicon glyphicon-cog"></i>登录
	</a>
	<a target="_self" class="login" href="javascript:alertRegister()">
		<i class="glyphicon glyphicon-cog"></i>注册
	</a>
    {/if}
	<!-- <a target="_self" class="login search_icon" href="javascript:showSearch()">
		<i class="glyphicon glyphicon-search"></i>
	</a> -->


		<!-- <button id="alertlogin">alert</button> -->
	<!-- <a class=" login set-view-mode pull-right" data-mode="day" href="javascript:void(0)">
		<i class="glyphicon glyphicon-cog"></i>
	</a> -->
</div>


<script type="text/javascript">
	// 更改导航栏选中状态
	$(function(){
		var slug = $('.page-title ul .active a').attr('sub-slug');
		// 如果完全动态化后,这个选中状态值将从数据库中获取
		var activeArr = Array('index','category','tag','album','message','link','about');
		var idx = activeArr.indexOf(slug.toLowerCase());
		if(!slug || idx < 0) idx = 0;
		$('.nav-big .dropdown a:eq('+idx+')').addClass('logo');


		$('.user-name').hover(function(){
			$('.user-menu').fadeIn('slow');
		},function(){
			$('.user-menu').fadeOut('slow');
		});
	});
</script>
<div class="navbar-jianshu nav-big">
	<div class="dropdown">
		<a class=" active" role="button" data-original-title="个人主页" data-container="div.expanded" href="__HTP____URL__" title="home">
	 		<b>SIN</b>
		    <!-- <i class="glyphicon glyphicon-book"></i> -->
		    <span class="title">Index</span>
		</a>
		<a class="active" href="__HTP____URL__/categories.html" title="Categories">
		    <i class="glyphicon glyphicon-book"></i>
		    <span class="title">Categories</span>
		</a>
		<a href="__HTP____URL__/tags.html" title="Tags">
		    <i class="glyphicon glyphicon-tag"></i><span class="title">Tags</span>
		</a>
		<a href="__HTP____URL__/album.html" title="Album">
		    <i class="glyphicon glyphicon-picture"></i><span class="title">album</span>
		</a>
		<a href="__HTP____URL__/messages.html" title="Messages">
		    <i class="
glyphicon glyphicon-envelope"></i>
            <span class="title">Messages</span>
        </a>
        <a href="__HTP____URL__/links.html" title="Links">
		    <i class="glyphicon glyphicon-link"></i>
		    <span class="title">Links</span>
		</a>
		<a href="__HTP____URL__/about.html" title="About">
		    <i class="glyphicon glyphicon-info-sign"></i>
		    <span class="title">About</span>
	    </a>
	</div>
</div>